package net.siufung.market.base.user.controller.regulation;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import net.siufung.core.exception.BizServiceException;
import net.siufung.core.model.regulation.AbstractRegulation;
import net.siufung.security.api.AuthUtil;

/**
 * @author 陈建峰
 * @since 2022/4/18 2:09 下午
 */
@AllArgsConstructor
public class UserUpdatePasswdRegulation extends AbstractRegulation<Integer> {

    private static final long serialVersionUID = 4278919973675557941L;

    @Override
    public boolean isSatisfiedBy(Integer userId) {
        if(!StrUtil.equals(AuthUtil.getUserId(), String.valueOf(userId))){
            throw new BizServiceException("非当前用户不能修改密码！");
        }
        return Boolean.TRUE;
    }
}
